//
//  MPTableViewController.m
//  MPTCustomUILibrary
//
//  Created by 龙鹏飞 on 2017/9/19.
//  Copyright © 2017年 jxzjxz. All rights reserved.
//

#import "MPTableViewController.h"
#import "AViewController.h"
#import "AlertViewTestViewController.h"
#import "MPFCusNaviVC.h"

@interface MPTableViewController ()

@property (nonatomic, strong) NSArray *dataArray;

@end

@implementation MPTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.dataArray = @[
                       @"NavigationBar",
                       @"AlertView",
                       @"MPFCusNaviVC"
                       ];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = self.dataArray[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    switch (indexPath.row) {
        case 0:
        {
            AViewController *con = [[AViewController alloc]init];
            [self.navigationController pushViewController:con animated:YES];
        }
            break;
        case 1:
        {
            AlertViewTestViewController *con = [[AlertViewTestViewController alloc] init];
            [self.navigationController pushViewController:con animated:YES];
        }
            break;
        case 2:{
            MPFCusNaviVC *vc = [[MPFCusNaviVC alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        default:
            break;
    }
}

@end
